﻿<cfsilent>
	<cfscript>
		
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		
		event.setArg("pageTitle", "教室调度单");
		
		/* 读取学校信息 */
		sql = "SELECT sch_name, sch_name_eng FROM t_school ";

		queryObj = new Query( datasource=application.dnsSlave );
			
		rs_school = queryObj.execute( sql=sql ).getResult();
		
		schoolName = "";
		schoolEnglishName = "";
		
		if ( rs_school.recordCount ) {
			
			schoolName = rs_school.sch_name;
			schoolEnglishName = rs_school.sch_name_eng;

		}
		
		/* 读取预约信息 */
		sql = "SELECT 
				tch_approve, use_time, use_rooms, use_week, time_review, 
				t_teacher.tch_id, t_teacher.tch_name, 
				t_institute.institute_name, 
				t_clsroom_usetype.ut_id, t_clsroom_usetype.usage
				FROM t_clsroom_borrow 
				INNER JOIN t_teacher ON t_teacher.tch_id = t_clsroom_borrow.tch_id 
				INNER JOIN t_institute ON t_institute.institute_id = t_clsroom_borrow.institute_id 
				INNER JOIN t_clsroom_usetype ON t_clsroom_usetype.ut_id = t_clsroom_borrow.ut_id 
				WHERE cbr_id = :docId ";

		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="docId", value=docId, cfsqltype="cf_sql_char" );

		rs_doc = queryObj.execute( sql=sql ).getResult();
		
		tagCode = "JSDD-" & rs_doc.ut_id & "-" & docId;
		
		docLooper = 3;
		
	</cfscript>
</cfsilent>

<cfloop from="1" to="#docLooper#" index="i">

	<div class="UIreportTitle">
		<h2><cfoutput>#schoolName#</cfoutput> 教室调度单</h2>
	</div>
	
	<table width="98%" border="0" cellpadding="1" cellspacing="0">
		<tr>
			<td>
				<cfswitch expression="#i#">
					<cfcase value="1">
						第一联 部门存根
					</cfcase>
					<cfcase value="2">
						第二联 负责人留存
					</cfcase>
					<cfcase value="3">
						第三联 教室管理人员存根
					</cfcase>
				</cfswitch>
			</td>
			<td align="right">流水号: <cfoutput>#docId#</cfoutput></td>
		</tr>
	</table>

	<div class="clear2px"></div>
	
	<table class="UIreportTable">
		<tr>
			<td width="60" class="centered">部门</td>
			<td><cfoutput>#rs_doc.institute_name#</cfoutput></td>
			<td width="80" class="centered">负责人</td>
			<td width="200"><cfoutput>#rs_doc.tch_name#</cfoutput>(<cfoutput>#rs_doc.tch_id#</cfoutput>)</td>
		</tr>
		<tr>
			<td class="centered">周次</td>
			<td><cfoutput>#rs_doc.use_week#</cfoutput></td>
			<td class="centered">审核人</td>
			<td><cfoutput>#rs_doc.tch_approve#</cfoutput></td>
		</tr>
		<tr height="110">
			<td class="centered">预约</td>
			<td colspan="3"><cfoutput>#rs_doc.use_time#</cfoutput>，<cfoutput>#rs_doc.use_rooms#</cfoutput></td>
		</tr>
		<tr>
			<td class="centered">用途</td>
			<td><cfoutput>#rs_doc.usage#</cfoutput></td>
			<td class="centered">审批时间</td>
			<td><cfoutput>#datetimeAdvice.formatDateString(rs_doc.time_review, "YYYY年MM月DD日")#</cfoutput></td>
		</tr>
	</table>

	<cfif i lt docLooper>
		<div class="breakline"></div>
	</cfif>
	
</cfloop>

<div class="UIreportFoot">
	<table>
		<tr>
			<td>打印时间 <cfoutput>#dateFormat(now(), "YYYY年MM月DD日")#</cfoutput></td>
			<td>（签章有效）</td>
			<td align="right"><img src="<cfoutput>#getContextRoot()#</cfoutput>/barcode/Print/<cfoutput>#tagCode#</cfoutput>.png" height="43"/></td>			</tr>
	</table>
</div>

